<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!-- 引入jquery文件 -->
    <script src="../jquery.min.js"></script>
    <!-- 引入bootstrap.min.css,  bootstrap.min.css,   bootstrap.min.js文件 -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="js/bootstrap.min.js">
    <title>bootstrap导航组件运用</title>
    <style>
        
    </style>
</head>
<body>
    <div class="container">
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                  <!-- Brand and toggle get grouped for better mobile display -->
                  <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                      <span class="sr-only">Toggle navigation</span>
                      <span class="icon-bar"></span>
                      <span class="icon-bar"></span>
                      <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">浙江禾川</a>
                  </div>
                
                  <!-- Collect the nav links, forms, and other content for toggling -->
                  <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                      <li class="active"><a href="#">首页 <span class="sr-only">(current)</span></a></li>
                      <li><a href="#">关于我们</a></li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">产品/服务 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                          <li><a href="#">控制</a></li>
                          <li><a href="#">驱动</a></li>
                          <li><a href="#">传感</a></li>
                          <li role="separator" class="divider"></li>
                          <li><a href="#">系统</a></li>
                          <li role="separator" class="divider"></li>
                          <li><a href="#">待开发</a></li>
                        </ul>
                      </li>
                    </ul>
                    <form class="navbar-form navbar-left">
                      <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入">
                      </div>
                      <button type="submit" class="btn btn-default">搜索</button>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                      <li><a href="#">语言</a></li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">登录注册<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                          <li><a href="#" data-toggle="modal" data-target=".login">登录</a></li>
                          <li role="separator" class="divider"></li>
                          <li><a href="#">注册</a></li>
                        </ul>
                        <!-- 模态框 -->
                        <div class="modal fade login" tabindex="-1" role="dialog">
                            <div class="modal-dialog" role="document">
                              <div class="modal-content">
                                <div class="modal-header">
                                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                  <h4 class="modal-title">登录信息</h4>
                                </div>
                                <div class="modal-body">
                                  <!-- 这里放登录信息的表单 -->
                                  <form>
                                      <div class="form-group">
                                        <label for="exampleInputEmail1">用户邮箱</label>
                                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
                                      </div>
                                      <div class="form-group">
                                        <label for="exampleInputPassword1">密码</label>
                                        <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                                      </div>
                                      <!-- <div class="form-group">
                                        <label for="exampleInputFile">File input</label>
                                        <input type="file" id="exampleInputFile">
                                        <p class="help-block">Example block-level help text here.</p>
                                      </div> -->
                                      <div class="checkbox">
                                        <label>
                                          <input type="checkbox"> 记住用户名
                                        </label>
                                      </div>
                                      <!-- <button type="submit" class="btn btn-default">Submit</button> -->
                                    </form>
                                </div>
                                <!-- 模态框的关闭和登录按钮 -->
                                <div class="modal-footer">
                                  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                  <button type="button" class="btn btn-primary">登录</button>
                                </div>
                              </div><!-- /.modal-content -->
                            </div><!-- /.modal-dialog -->
                          </div><!-- /.modal -->
                      </li><!-- /.dropdown -->
                    </ul>
                  </div><!-- /.navbar-collapse -->
                </div><!-- /.container-fluid -->
            </nav>

            <!-- 标签页：导航切换 -->
            <div>
                <!-- Nav tabs -->
                <ul class="nav nav-tabs" role="tablist">
                  <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
                  <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
                  <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
                  <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
                </ul>
                <!-- Tab panes -->
                <div class="tab-content">
                  <div role="tabpanel" class="tab-pane active" id="home">home...</div>
                  <div role="tabpanel" class="tab-pane" id="profile">profile...</div>
                  <div role="tabpanel" class="tab-pane" id="messages">...</div>
                  <div role="tabpanel" class="tab-pane" id="settings">...</div>
                </div>
            </div>

            <!-- 分页页码 -->
            <nav aria-label="Page navigation">
              <ul class="pagination">
                <li>
                  <a href="#" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                  </a>
                </li>
                <li><a href="#">1</a></li>
                <li><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li><a href="#">4</a></li>
                <li><a href="#">5</a></li>
                <li>
                  <a href="#" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                  </a>
                </li>
              </ul>
            </nav>


    </div>

    <script>
      $(function(){
        // 当点击下拉菜单时，菜单上下滑动切换
        var i = 0;
        $('.dropdown-toggle').click(function(){
          $(this).siblings("ul").stop().slideToggle(500);
          i = 1;
        });
        // 如果下拉框被拉下来，除了点击ul盒子，点击浏览器的任何地方都可以将下拉框拉上去
        // $(document).click(function(){
        //   // 如何判断元素是否处于下拉状态
        //   if(i==1){
        //     $('.dropdown-menu').stop().slideDown();
        //     i==0;
        //   }if(i==0){
        //     $('.dropdown-menu').stop().slideUp();
        //   }
          
        //   console.log('ssss');
        // });


      })


    </script>
</body>
</html>